﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NCMIS.AccessControl;
using NCMIS.ObjectModel;
using NCMIS.ObjectModel.MetaData;
using NCMIS.Produce;

namespace NCMIS.Provider.SampleProvider
{
    /// <summary>
    /// Handles the creation of sample CMIS Objects.
    /// </summary>
    public static class SampleFactory
    {
        #region Initialization

        // List of all CMIS objects currently in the sample repository. This list is only saved in memory, 
        // and will be reset whenever the server resets.
        private static IList<CmisObject> _objects;
        // List of all objects content streams in the sample repository. This list is only saved in memory, 
        // and will be reset whenever the server resets.
        private static IList<ContentStream> _contentStreams;
        private static IList<TypeDefinition> _types;

        /// <summary>
        /// Initializes the member variables with default values. Restets the Sample Repository to its initial value. 
        /// No effect unless the objects list is not yet set.
        /// </summary>
        public static void Initialize()
        {
            // The first method call may be from any of the Sample Provider classes, therefore each of the classes must 
            // be able to initialize the Sample Factory. There is no guarantee that the GetRepository mehtod of the 
            // SampleRepositoryProvider will be the first method to be called. If the _objects list is already initialized, 
            // it must not be reset.
            if (_objects == null)
            {
                _objects = CreateDefaultObjects();
                _contentStreams = CreateDefaultObjectsContentStreams();
            }

            if (_types == null)
            {
                _types = CreateDefaultTypes();
            }
        }

        #endregion

        #region Existance Checking Methods

        /// <summary>
        /// Checks if a specified cmis:document object (or cmis:document object descendant) exists in the Sample Repository.
        /// </summary>
        /// <param name="folderId">The ID of the cmis:document to search for.</param>
        /// <returns>True if the cmis:document was found, else false.</returns>
        internal static bool DocumentExists(string documentId)
        {
            return ObjectExists(documentId, "cmis:document");
        }

        /// <summary>
        /// Checks if a specified cmis:folder object (or cmis:folder object descendant) exists in the Sample Repository.
        /// </summary>
        /// <param name="folderId">The ID of the cmis:folder to search for.</param>
        /// <returns>True if the cmis:folder was found, else false.</returns>
        internal static bool FolderExists(string folderId)
        {
            return ObjectExists(folderId, "cmis:folder");
        }

        /// <summary>
        /// Checks if a specified CMIS object (or object descendant) exists in the Sample Repository.
        /// </summary>
        /// <param name="folderId">The ID of the CMIS object to search for.</param>
        /// <param name="baseTypeId">The baseTypeId of the object to search for.</param>
        /// <returns>True if the CMIS object was found, else false.</returns>
        private static bool ObjectExists(string objectId, string baseTypeId)
        {
            // Root folder is not stored in _objects list, quick workaround to always return true on exist check
            if (objectId == "rootfolder" && baseTypeId == "cmis:folder")
            {
                return true;
            }

            foreach (CmisObject obj in _objects.Where<CmisObject>(obj2 => obj2.Properties.BaseTypeId.SingleValue == baseTypeId))
            {
                if (obj.Properties.ObjectId.SingleValue == objectId)
                {
                    return true;
                }
            }
            return false;
        }

        #endregion

        #region Insert Methods

        /// <summary>
        /// Inserts a document object
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="parentFolderId"></param>
        /// <param name="contentStream"></param>
        /// <returns></returns>
        internal static CmisObject InsertDocument(CmisProperties properties, string parentFolderId, ContentStream contentStream)
        {
            if (properties.Name == null || parentFolderId == null || contentStream == null)
            {
                return null;
            }

            string id = string.Format("{0}doc", properties.Name.SingleValue.Replace(" ", string.Empty));

            if (!FolderExists(parentFolderId) || DocumentExists(id))
            {
                return null;
            }

            CmisObject cmisObject = new CmisObject()
            {
                Id = id,
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] { contentStream.Filename }),
                        CreateCmisPropertyContentStreamId(new string[] { id }), // StreamId == DocumentId
                        CreateCmisPropertyContentStreamLength(new int[] { (int)contentStream.Length }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { contentStream.MimeType }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(properties.Name.Value), 
                        CreateCmisPropertyObjectId(new string[] { id }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { parentFolderId }),
                        CreateCmisPropertyPath(new string[] { "/" })
                    }
                }
            };

            contentStream.Id = id;

            _objects.Add(cmisObject);
            _contentStreams.Add(contentStream);

            return cmisObject; ;
        }

        /// <summary>
        /// Inserts a folder object
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="parentFolderId"></param>
        /// <returns></returns>
        internal static CmisObject InsertFolder(CmisProperties properties, string parentFolderId)
        {
            if (properties.Name == null || parentFolderId == null)
            {
                return null;
            }

            string id = string.Format("{0}folder", properties.Name.SingleValue);

            if (!FolderExists(parentFolderId) || FolderExists(id))
            {
                return null;
            }

            CmisObject cmisObject = new CmisObject()
            {
                Id = id,
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(properties.Name.Value),
                        CreateCmisPropertyObjectId(new string[] { id }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyParentId(new string[] { parentFolderId }),
                        CreateCmisPropertyPath(new string[] { string.Format("/{0}", properties.Name.SingleValue) })
                    }
                }
            };

            _objects.Add(cmisObject);

            return cmisObject;
        }

        #endregion

        #region Delete Method

        /// <summary>
        /// Deletes the specified object and its content stream.
        /// </summary>
        /// <param name="objectId">The ID of the object to delete.</param>
        internal static void DeleteObject(string objectId)
        {
            foreach (CmisObject cmisObject in _objects)
            {
                string id = cmisObject.Properties.ObjectId.SingleValue;
                if (id == objectId)
                {
                    // Delete object by removing it from the _objects list
                    _objects.Remove(cmisObject);
                    // Delete content stream by removing it from the _contentStreams list
                    ContentStream stream = GetContentStream(objectId);
                    _contentStreams.Remove(stream);
                    break;
                }
            }
        }

        #endregion

        #region Get Methods

        /// <summary>
        /// Gets the children of a given object.
        /// </summary>
        /// <param name="objectId">The object to retrieve children from.</param>
        /// <returns>An <see cref="NCMIS.ObjectModel.PathedCmisObjectList"/> object, containing child objects.</returns>
        internal static PathedCmisObjectList GetChildren(string objectId)
        {
            List<PathedCmisObject> list = new List<PathedCmisObject>();
            foreach (CmisObject cmisObject in _objects)
            {
                if (cmisObject.Properties.ParentId != null)
                {
                    if (cmisObject.Properties.ParentId.SingleValue == objectId)
                    {
                        list.Add(new PathedCmisObject() { Object = cmisObject, RelativePathSegment = "Relative Path" });
                        //list.Add(new PathedCmisObject() { Object = cmisObject, RelativePathSegment = cmisObject.Properties.Path.SingleValue });
                    }
                }
            }
            PathedCmisObjectList pathedCmisObjectList = new PathedCmisObjectList()
            {
                Objects = list.ToArray(),
                HasMoreItems = false,
                NumItems = list.Count.ToString()
            };
            return pathedCmisObjectList;
        }

        /// <summary>
        /// Gets a <see cref="NCMIS.ObjectModel.ContentStream"/> instance by its ID.
        /// </summary>
        /// <param name="streamId">The ID of the <see cref="NCMIS.ObjectModel.ContentStream"/> instance.</param>
        /// <returns>An <see cref="NCMIS.ObjectModel.ContentStream"/> object, or null if no matching object was found.</returns>
        internal static ContentStream GetContentStream(string streamId)
        {
            foreach (ContentStream stream in _contentStreams)
            {
                if (stream.Id == streamId)
                {
                    return stream;
                }
            }
            return null;
        }

        /// <summary>
        /// Gets a <see cref="NCMIS.ObjectModel.CmisObject"/> instance by its ID.
        /// </summary>
        /// <param name="objectId"></param>
        /// <returns></returns>
        internal static CmisObject GetObject(string objectId)
        {
            foreach (CmisObject cmisObject in _objects)
            {
                if (cmisObject.Properties.ObjectId.SingleValue == objectId)
                {
                    return cmisObject;
                }
            }
            return null;
        }

        /// <summary>
        /// Gets the repository base types.
        /// </summary>
        /// <param name="TypeId">The id of the type to get children for.</param>
        /// <returns>A <see cref="NCMIS.ObjectModel.MetaData.TypeDefinitionList"/> object.</returns>
        internal static TypeDefinitionList GetChildrenTypes(string typeId)
        {
            List<TypeDefinition> list = new List<TypeDefinition>();
            foreach (TypeDefinition type in _types)
            {
                if (type.ParentId == typeId)
                {
                    list.Add(type);
                }
            }
            return new TypeDefinitionList() { Types = list.ToArray(), HasMoreItems = false, NumItems = list.Count.ToString() };
        }

        /// <summary>
        /// Gets the descendant types of a given type.
        /// </summary>
        /// <param name="TypeId">The id of the type to get descendants for.</param>
        /// <returns>A <see cref="NCMIS.ObjectModel.MetaData.TypeContainer"/> object array.</returns>
        internal static TypeContainer[] GetDescendantTypes(string typeId)
        {
            List<TypeContainer> list = new List<TypeContainer>();
            foreach (TypeDefinition type in _types)
            {
                if (type.ParentId == typeId)
                {
                    list.Add(new TypeContainer() { Type = type, Children = null });
                }
            }
            return list.ToArray();
        }

        /// <summary>
        /// Gets the type definition of a given type
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        internal static TypeDefinition GetTypeDefinition(string typeId)
        {
            TypeDefinition result = null;
            foreach (TypeDefinition type in _types)
            {
                if (type.Id == typeId)
                {
                    result = type;
                    break;
                }
            }
            return result;
        }

        #endregion

        #region Default objects

        /// <summary>
        /// Creates the initial CMIS objects (cmis:documents and cmis:folders) in the Sample Repository.
        /// </summary>
        /// <returns>An <see cref="System.Collections.Generic.IList"/> object of Root Folder Children.</returns>
        public static IList<CmisObject> CreateDefaultObjects()
        {
            IList<CmisObject> list = new List<CmisObject>();

            list.Add(CreateRootFolder());

            list.Add(CreateDocumentsFolder());
            list.Add(CreateWordDocument());
            list.Add(CreateCmisSpecCd04DocDocument());
            list.Add(CreateCmisSpecCd04PdfDocument());

            list.Add(CreateCarsFolder());
            list.Add(CreateSportsCarsFolder());
            list.Add(CreateMotorcyclesFolder());
            list.Add(CreateCarsFile());
            list.Add(CreatePorscheFile());
            list.Add(CreateLamborghiniFile());
            list.Add(CreateHarleyFile());
            
            return list;
        }

        /// <summary>
        /// Creates the initial CMIS object content streams in the Sample Repository.
        /// </summary>
        /// <returns>An <see cref="System.Collections.Generic.IList"/> object of content streams.</returns>
        public static IList<ContentStream> CreateDefaultObjectsContentStreams()
        {
            IList<ContentStream> list = new List<ContentStream>();

            list.Add(CreateWordDocumentContentStream());
            list.Add(CreateCmisSpecCd04DocDocumentContentStream());
            list.Add(CreateCmisSpecCd04PdfDocumentContentStream());

            list.Add(CreateCarsContentStream());
            list.Add(CreatePorscheContentStream());
            list.Add(CreateLamborghiniContentStream());
            list.Add(CreateHarleyContentStream());

            return list;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static IList<TypeContainer> GetCurrentTypeContainers()
        {
            IList<TypeContainer> list = new List<TypeContainer>();
            foreach (TypeDefinition type in _types)
            {
                list.Add(new TypeContainer() { Type = type, Children = null });
            }
            return list;
        }

        /// <summary>
        /// Creates the initial CMIS default object types
        /// </summary>
        /// <returns></returns>
        public static IList<TypeDefinition> CreateDefaultTypes()
        {
            IList<TypeDefinition> list = new List<TypeDefinition>();
            list.Add(CreateDocumentType());
            list.Add(CreateFolderType());
            list.Add(CreatePolicyType());
            list.Add(CreateRelationshipType());
            list.Add(CreateSystemFolderType());

            return list;
        }

        #region Default cmis:folder Objects

        /// <summary>
        /// Creates the root folder
        /// </summary>
        /// <returns></returns>
        private static CmisObject CreateRootFolder()
        {
            return new CmisObject()
            {
                Id = "rootfolder",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(new string[] { "Root" }),
                        CreateCmisPropertyObjectId(new string[] { "rootfolder" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyPath(new string[] { "/" })
                    }
                }
            };
        }



        /// <summary>
        /// Creates the Cars folder
        /// </summary>
        /// <returns></returns>
        private static CmisObject CreateCarsFolder()
        {
            return new CmisObject()
            {
                Id = "carsfolder",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(new string[] { "Cars" }),
                        CreateCmisPropertyObjectId(new string[] { "carsfolder" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyParentId(new string[] { "rootfolder" }),
                        CreateCmisPropertyPath(new string[] { "/Cars/" })
                    }
                }
            };
        }

        /// Creates the Cars folder
        /// </summary>
        /// <returns></returns>
        private static CmisObject CreateSportsCarsFolder()
        {
            return new CmisObject()
            {
                Id = "sportscarsfolder",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(new string[] { "SportsCars" }),
                        CreateCmisPropertyObjectId(new string[] { "sportscarsfolder" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyParentId(new string[] { "carsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/Cars/SportsCars/" })
                    }
                }
            };
        }

        /// Creates the Cars folder
        /// </summary>
        /// <returns></returns>
        private static CmisObject CreateMotorcyclesFolder()
        {
            return new CmisObject()
            {
                Id = "motorcyclesfolder",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(new string[] { "Motorcycles" }),
                        CreateCmisPropertyObjectId(new string[] { "motorcyclesfolder" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyParentId(new string[] { "rootfolder" }),
                        CreateCmisPropertyPath(new string[] { "/Motorcycles/" })
                    }
                }
            };
        }

        /// <summary>
        /// Creates the Documents folder
        /// </summary>
        /// <returns></returns>
        private static CmisObject CreateDocumentsFolder()
        {
            return new CmisObject()
            {
                Id = "documentsfolder",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyAllowedChildObjectTypeIds(null),
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyName(new string[] { "Documents" }),
                        CreateCmisPropertyObjectId(new string[] { "documentsfolder" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:folder" }),
                        CreateCmisPropertyParentId(new string[] { "rootfolder" }),
                        CreateCmisPropertyPath(new string[] { "/Documents/" })
                    }
                }
            };
        }

        #endregion

        #region Content Streams

        /// <summary>
        /// Creates a new CMIS spec CD04 (.doc) Document Content Stream (DCS)
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreateCmisSpecCd04DocDocumentContentStream()
        {
            return CreateContentStreamHelper("NCMIS.Provider.SampleProvider.Files.cmis-spec-v1.0cd04.doc", "cmisspeccd04docdocument", "cmis-spec-v1.0cd04.doc", "application/word");
        }

        /// <summary>
        /// Creates a new CMIS spec CD04 (.pdf) DCS
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreateCmisSpecCd04PdfDocumentContentStream()
        {
            return CreateContentStreamHelper("NCMIS.Provider.SampleProvider.Files.cmis-spec-v1.0cd04.pdf", "cmisspeccd04pdfdocument", "cmis-spec-v1.0cd04.pdf", "application/pdf");
        }

        /// <summary>
        /// Create a new content stream for porsche.txt
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreatePorscheContentStream()
        {

            byte[] bytes = System.Text.ASCIIEncoding.UTF8.GetBytes("Porsche Automobil Holding SE, usually shortened to Porsche SE, a Societas Europaea or European Public Company, \n" +
                     "is a German automotive manufacturer of luxury high performance automobiles, which is majority-owned by the Piech \n" +
                     "and Porsche families. Porsche SE is headquartered in Zuffenhausen, a city district of Stuttgart, Baden-Wurttemberg.");
            ContentStream contentStream = new ContentStream()
            {
                Id = "porschefile",
                Filename = "porsche.txt",
                Length = (uint?)bytes.Length,
                MimeType = "text/plain",
                Stream = bytes,
            };
            return contentStream;
        }

        /// <summary>
        /// Create a new content stream for lamborghini.txt
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreateLamborghiniContentStream()
        {
            byte[] bytes = System.Text.ASCIIEncoding.UTF8.GetBytes("Automobili Lamborghini S.p.A., commonly referred to as Lamborghini, is an Italian automaker based in the small \n" +
                     "township of Sant'Agata Bolognese. The company was founded in 1963 by manufacturing magnate Ferruccio Lamborghini, \n" +
                     "who set out to create a refined grand touring car. The company's first offerings, the 350GT and 400GT, were noted \n" +
                     "for their refinement, power, and comfort.");
            ContentStream contentStream = new ContentStream()
            {
                Id = "lamborghinifile",
                Filename = "lamborghini.txt",
                Length = (uint?)bytes.Length,
                MimeType = "text/plain",
                Stream = bytes,
            };
            return contentStream;
        }

        /// <summary>
        /// Create a new content stream for the ReadMe file
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreateHarleyContentStream()
        {
            byte[] bytes = System.Text.ASCIIEncoding.UTF8.GetBytes("Harley-Davidson, often abbreviated H-D or Harley, is an American motorcycle manufacturer. Founded in Milwaukee, \n" +
                     "Wisconsin, during the first decade of the 20th century, it was one of two major American motorcycle manufacturers \n" +
                     "to survive the Great Depression. Harley-Davidson also survived a period of poor quality control and competition \n" +
                     "from Japanese manufacturers.");
            ContentStream contentStream = new ContentStream()
            {
                Id = "harleyfile",
                Filename = "harley-davidson.txt",
                Length = (uint?)bytes.Length,
                MimeType = "text/plain",
                Stream = bytes,
            };
            return contentStream;
        }

        /// <summary>
        /// Create a new content stream for the ReadMe file
        /// </summary>
        /// <returns></returns>
        private static ContentStream CreateCarsContentStream()
        {
            byte[] bytes = System.Text.ASCIIEncoding.UTF8.GetBytes("An automobile, motor car or car is a wheeled motor vehicle used for transporting passengers, which also carries its, \n" +
                        "own engine or motor. Most definitions of the term specify that automobiles are designed to run primarily on roads, \n" +
                        "to have seating for one to eight people, to typically have four wheels, and to be constructed principally for the \n" +
                        "transport of people rather than goods.");
            ContentStream contentStream = new ContentStream()
            {
                Id = "carsfile",
                Filename = "cars.txt",
                Length = (uint?)bytes.Length,
                MimeType = "text/plain",
                Stream = bytes,
            };
            return contentStream;
        }

        /// <summary>
        /// Creates a new content stream for the sample MS Word document
        /// </summary>
        /// <returns></returns>
        public static ContentStream CreateWordDocumentContentStream()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            // GetManifestResourceStream(<Namespace>.<Subfolders>.<FileName>.<extension>)
            Stream stream = assembly.GetManifestResourceStream("NCMIS.Provider.SampleProvider.Files.Sample.docx");
            byte[] bytes = ConvertStreamToByteArray(stream);
            ContentStream contentStream = new ContentStream()
            {
                Id = "sampleworddocument",
                Filename = "Sample.docx",
                Length = (uint?)bytes.Length,
                MimeType = "application/ms-word",
                Stream = bytes,
            };
            return contentStream;
        }

        /// <summary>
        /// Responsible for the actual creation of content streams
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <param name="filename"></param>
        /// <param name="mimeType"></param>
        /// <returns></returns>
        private static ContentStream CreateContentStreamHelper(string name, string id, string filename, string mimeType)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            // GetManifestResourceStream(<Namespace>.<Subfolders>.<ImageName>.<extension>)
            Stream stream = assembly.GetManifestResourceStream(name);
            byte[] bytes = ConvertStreamToByteArray(stream);
            ContentStream contentStream = new ContentStream()
            {
                Id = id,
                Filename = filename,
                Length = (uint?)bytes.Length,
                MimeType = mimeType,
                Stream = bytes,
            };
            return contentStream;
        }

        #endregion

        #region Default cmis:document Objects

        /// <summary>
        /// Creates a sample MS Word document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateWordDocument()
        {
            return new CmisObject()
            {
                Id = "sampleworddocument",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"Sample.docx"}),
                        CreateCmisPropertyContentStreamId(new string[] { "sampleworddocument" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "application/word" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "Sample.docx" }),
                        CreateCmisPropertyObjectId(new string[] { "sampleworddocument" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "documentsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a CMIS spec CD04 (.doc) document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCmisSpecCd04DocDocument()
        {
            return new CmisObject()
            {
                Id = "cmisspeccd04docdocument",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"cmis-spec-v1.0cd04.doc"}),
                        CreateCmisPropertyContentStreamId(new string[] { "cmisspeccd04docdocument" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "application/word" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "cmis-spec-v1.0cd04.doc" }),
                        CreateCmisPropertyObjectId(new string[] { "cmisspeccd04docdocument" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "documentsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a CMIS spec CD04 (.pdf) document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCmisSpecCd04PdfDocument()
        {
            return new CmisObject()
            {
                Id = "cmisspeccd04pdfdocument",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"cmis-spec-v1.0cd04.pdf"}),
                        CreateCmisPropertyContentStreamId(new string[] { "cmisspeccd04pdfdocument" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "application/pdf" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "cmis-spec-v1.0cd04.pdf" }),
                        CreateCmisPropertyObjectId(new string[] { "cmisspeccd04pdfdocument" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "documentsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a porsche.txt document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreatePorscheFile()
        {
            return new CmisObject()
            {
                Id = "porschefile",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"porsche.txt"}),
                        CreateCmisPropertyContentStreamId(new string[] { "porschefile" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "text/plain" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "porsche.txt" }),
                        CreateCmisPropertyObjectId(new string[] { "porschefile" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "documentsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a lamborghini.txt document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateLamborghiniFile()
        {
            return new CmisObject()
            {
                Id = "lamborghinifile",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"lamborghini.txt"}),
                        CreateCmisPropertyContentStreamId(new string[] { "lamborghinifile" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "text/plain" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "lamborghini.txt" }),
                        CreateCmisPropertyObjectId(new string[] { "lamborghinifile" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "sportscarsfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a harley-davidston.txt document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateHarleyFile()
        {
            return new CmisObject()
            {
                Id = "harleyfile",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"harley-davidson.txt"}),
                        CreateCmisPropertyContentStreamId(new string[] { "harleyfile" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "text/plain" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "harley-davidson.txt" }),
                        CreateCmisPropertyObjectId(new string[] { "harleyfile" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "motorcyclesfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        /// <summary>
        /// Creates a cars.txt document object
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCarsFile()
        {
            return new CmisObject()
            {
                Id = "carsfile",
                Properties = new CmisProperties
                {
                    Items = new CmisProperty[]
                    {
                        CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyContentStreamFileName(new string[] {"cars.txt"}),
                        CreateCmisPropertyContentStreamId(new string[] { "carsfile" }),
                        CreateCmisPropertyContentStreamLength(new int[] { 42978 }),
                        CreateCmisPropertyContentStreamMimeType(new string[] { "text/plain" }),
                        CreateCmisPropertyIsImmutable(new bool[] { false }),
                        CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                        CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                        CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                        CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                        CreateCmisPropertyName(new string [] { "cars.txt" }),
                        CreateCmisPropertyObjectId(new string[] { "carsfile" }),
                        CreateCmisPropertyObjectTypeId(new string[] { "cmis:document" }),
                        CreateCmisPropertyParentId(new string[] { "rootfolder" }),
                        CreateCmisPropertyPath(new string[] { "/" })                        
                    }
                }
            };
        }

        #endregion

        #endregion

        #region Object-type Attribute Definitions

        /// <summary>
        /// Define attributes for the Document Object-type (see section
        /// 2.1.4.3.2 Attribute values).
        /// </summary>
        /// <returns></returns>
        public static TypeDefinition CreateDocumentType()
        {
            return new TypeDocumentDefinition()
            {
                BaseId = BaseObjectTypeId.CmisDocument,
                ControllableAcl = false,
                ControllablePolicy = false,
                Creatable = true,
                Description = "Document Type",
                DisplayName = "Document",
                Fileable = true,
                FulltextIndexed = true,
                Id = "cmis:document",
                IncludedInSupertypeQuery = true,
                LocalName = "document",
                LocalNamespace = "NCMIS.ObjectModel.MetaData.TypeDocumentDefinition",
                ParentId = null,
                Queryable = true,
                QueryName = "cmis:folder"
            };
        }

        /// <summary>
        /// Define attributes for the Folder Object-type (see section
        /// 2.1.5.4.1 Attribute values).
        /// </summary>
        /// <returns></returns>
        public static TypeDefinition CreateFolderType()
        {
            return new TypeFolderDefinition()
            {
                BaseId = BaseObjectTypeId.CmisFolder,
                ControllableAcl = false,
                ControllablePolicy = false,
                Creatable = true,
                Description = "Folder Type",
                DisplayName = "Folder",
                Fileable = false,
                FulltextIndexed = true,
                Id = "cmis:folder",
                IncludedInSupertypeQuery = true,
                LocalName = "folder",
                LocalNamespace = "NCMIS.ObjectModel.MetaData.TypeFolderDefinition",
                ParentId = null,
                Queryable = true,
                QueryName = "cmis:folder"
            };
        }

        /// <summary>
        /// Define attributes for the Policy Object-type (see section
        /// 2.1.7.1.1 Attribute values).
        /// </summary>
        /// <returns></returns>
        public static TypeDefinition CreatePolicyType()
        {
            return new TypePolicyDefinition()
            {
                BaseId = BaseObjectTypeId.CmisPolicy,
                ControllableAcl = false,
                ControllablePolicy = false,
                Creatable = true,
                Description = "Policy Type",
                DisplayName = "Policy",
                Fileable = false,
                FulltextIndexed = false,
                Id = "cmis:policy",
                IncludedInSupertypeQuery = true,
                LocalName = "policy",
                LocalNamespace = "NCMIS.ObjectModel.MetaData.TypePolicyDefinition",
                ParentId = null,
                Queryable = true,
                QueryName = "cmis:policy"
            };
        }

        /// <summary>
        /// Define attributes for the Relationship Object-type (see section
        /// 2.1.6.1.2 Attribute values).
        /// </summary>
        /// <returns></returns>
        public static TypeDefinition CreateRelationshipType()
        {
            return new TypeRelationshipDefinition()
            {
                AllowedSourceTypes = new string[] { string.Empty },
                AllowedTargetTypes = new string[] { string.Empty },
                BaseId = BaseObjectTypeId.CmisRelationship,
                ControllableAcl = false,
                ControllablePolicy = false,
                Creatable = true,
                Description = "Relationship Type",
                DisplayName = "Relationship",
                Fileable = false,
                FulltextIndexed = false,
                Id = "cmis:relationship",
                IncludedInSupertypeQuery = true,
                LocalName = "relationship",
                LocalNamespace = "NCMIS.ObjectModel.MetaData.TypeRelationshipDefinition",
                ParentId = null,
                Queryable = true,
                QueryName = "cmis:relationship"
            };
        }

        /// <summary>
        /// Define attributes for the System Folder Object-type (not included
        /// in the CMIS spec).
        /// </summary>
        /// <returns></returns>
        public static TypeDefinition CreateSystemFolderType()
        {
            return new TypeFolderDefinition()
            {
                BaseId = BaseObjectTypeId.CmisFolder,
                ControllableAcl = false,
                ControllablePolicy = false,
                Creatable = true,
                Description = "System Folder Type",
                DisplayName = "System Folder",
                Fileable = false,
                FulltextIndexed = true,
                Id = "ncmis:systemfolder",
                IncludedInSupertypeQuery = true,
                LocalName = "folder",
                LocalNamespace = "NCMIS.ObjectModel.MetaData.TypeFolderDefinition",
                ParentId = "cmis:folder",
                Queryable = true,
                QueryName = "ncmis:systemfolder"
            };
        }

        #endregion

        #region Security, Permissions, etc.

        /// <summary>
        /// Create an Access Control List (ACL).
        /// </summary>
        /// <returns></returns>
        public static Acl CreateAcl()
        {
            return new Acl()
            {
                AccessControlList = SampleFactory.CreateAccessControlList(),
                Exact = true
            };
        }

        /// <summary>
        /// Adds a set of ACE's to an Access Control List (ACL).
        /// </summary>
        /// <returns></returns>
        public static AccessControlList CreateAccessControlList()
        {
            return new AccessControlList()
            {
                Permissions = new AccessControlEntry[]
                {
                    SampleFactory.CreateAccessControlEntry(),
                }
            };
        }

        /// <summary>
        /// Creates a set of dummy Access Control Entries (ACE).
        /// </summary>
        /// <returns></returns>
        public static AccessControlEntry CreateAccessControlEntry()
        {
            return new AccessControlEntry
            {
                Direct = true,
                Permissions = new string[]
                {
                    "Permission 1",
                    "Permission 2",
                    "Permission 3"
                },
                Principal = SampleFactory.CreateAccessControlPrincipal(),
            };
        }

        /// <summary>
        /// Create a dummy Access Control Principal (ACP).
        /// </summary>
        /// <returns></returns>
        public static AccessControlPrincipal CreateAccessControlPrincipal()
        {
            return new AccessControlPrincipal()
            {
                PrincipalId = "EPiPrincipalId"
            };
        }

        /// <summary>
        /// Define allowed actions
        /// </summary>
        /// <returns></returns>
        public static AllowableActions CreateAllowableActions()
        {
            return new AllowableActions()
            {
                CanAddObjectToFolder = true,
                //CanApplyACLSpecified = true,
                CanApplyACL = true,
                //CanAddObjectToFolderSpecified = true,
                CanApplyPolicy = true,
                //CanApplyPolicySpecified = true,
                CanCancelCheckOut = true,
                //canCancelCheckOutSpecified = true,
                CanCheckIn = true,
                //canCheckInSpecified = true,
                CanCheckOut = true,
                //CanCheckOutSpecified = true,
                CanCreateDocument = true,
                //CanCreateDocumentSpecified = true,
                CanCreateFolder = true,
                //CanCreateFolderSpecified = true,
                //CanCreatePolicy = true,
                //CanCreatePolicySpecified = true,
                CanCreateRelationship = true,
                //canCreateRelationshipSpecified = true,
                CanDeleteContentStream = true,
                //CanDeleteContentStreamSpecified = true,
                CanDeleteObject = true,
                //CanDeleteObjectSpecified = true,
                CanDeleteTree = true,
                //CanDeleteTreeSpecified = true,
                CanGetACL = true,
                //CanGetACLSpecified = true,
                CanGetAllVersions = true,
                //CanGetAllVersionsSpecified = true,
                CanGetAppliedPolicies = true,
                //CanGetAppliedPoliciesSpecified = true,
                CanGetChildren = true,
                //CanGetChildrenSpecified = true,
                CanGetContentStream = true,
                //CanGetContentStreamSpecified = true,
                CanGetDescendants = true,
                //CanGetDescendantsSpecified = true,
                CanGetFolderParent = true,
                //CanGetFolderParentSpecified = true,
                CanGetObjectParents = true,
                //canGetObjectParentsSpecified = true,
                CanGetObjectRelationships = true,
                //CanGetObjectRelationshipsSpecified = true,
                CanGetProperties = true,
                //canGetPropertiesSpecified = true,
                CanGetRenditions = true,
                //CanGetRenditionsSpecified = true,
                CanMoveObject = true,
                //CanMoveObjectSpecified = true,
                CanRemoveObjectFromFolder = true,
                //CanRemoveObjectFromFolderSpecified = true,
                CanRemovePolicy = true,
                //CanRemovePolicySpecified = true,
                CanSetContentStream = true,
                //CanSetContentStreamSpecified = true,
                CanUpdateProperties = true,
                //canUpdatePropertiesSpecified = true
            };
        }

        #endregion

        #region Create CMIS Properties

        /// <summary>
        /// Id's of the set of Object-types that can be created, moved or filed into this
        /// folder. Line 1271 in CMIS specification
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyAllowedChildObjectTypeIds(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Allowed Child Object Type Ids",
                LocalName = "AllowedChildObjectTypeIds",
                PropertyDefinitionId = CmisPropertyDefinitionId.AllowedChildObjectTypeIds,
                QueryName = CmisPropertyDefinitionId.AllowedChildObjectTypeIds,
                Value = value
            };
        }

        /// <summary>
        /// Id of the object's type.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyObjectTypeId(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Object Type Id",
                LocalName = "ObjectTypeId",
                PropertyDefinitionId = CmisPropertyDefinitionId.ObjectTypeId,
                QueryName = CmisPropertyDefinitionId.ObjectTypeId,
                Value = value
            };
        }

        /// <summary>
        /// Id of the object's type. Defaults to cmis:document.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyDocumentObjectTypeId()
        {
            return new CmisPropertyId()
            {
                DisplayName = "CMIS Document",
                LocalName = "CmisDocument",
                PropertyDefinitionId = CmisPropertyDefinitionId.ObjectTypeId,
                QueryName = "cmis:objectTypeId",
                Value = new string[] { "cmis:document" }
            };
        }

        /// <summary>
        /// Id of the object's type. Defaults to cmis:folder.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyFolderObjectTypeId()
        {
            return new CmisPropertyId()
            {
                DisplayName = "CMIS Folder",
                LocalName = "CmisFolder",
                PropertyDefinitionId = CmisPropertyDefinitionId.ObjectTypeId,
                QueryName = "cmis:objectTypeId",
                Value = new string[] { "cmis:folder" }
            };
        }

        /// <summary>
        /// Id of the object's type. Defaults to cmis:policy.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyPolicyObjectTypeId()
        {
            return new CmisPropertyId()
            {
                DisplayName = "CMIS Policy",
                LocalName = "CmisPolicy",
                PropertyDefinitionId = CmisPropertyDefinitionId.ObjectTypeId,
                QueryName = "cmis:objectTypeId",
                Value = new string[] { "cmis:policy" }
            };
        }

        /// <summary>
        /// User who last modified the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyLastModifiedBy(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Last Modified By",
                LocalName = "LastModifiedBy",
                PropertyDefinitionId = CmisPropertyDefinitionId.LastModifiedBy,
                QueryName = CmisPropertyDefinitionId.LastModifiedBy,
                Value = value
            };
        }

        /// <summary>
        /// The fully qualified path to this folder.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyPath(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Path",
                LocalName = "Path",
                PropertyDefinitionId = CmisPropertyDefinitionId.Path,
                QueryName = CmisPropertyDefinitionId.Path,
                Value = value
            };
        }

        /// <summary>
        /// Describes the position of an individual object with respect to the 
        /// version series, e.g. "Version 1.0".
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyVersionLabel()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Version Label",
                LocalName = "VersionLabel",
                PropertyDefinitionId = CmisPropertyDefinitionId.VersionLabel,
                QueryName = "cmis:versionLabel",
                Value = null
            };
        }

        /// <summary>
        /// Indicates which user created the PWC (Private Working Copy).
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyVersionSeriesCheckedOutBy()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Version Series Checked Out By",
                LocalName = "VersionSeriesCheckedOutBy",
                PropertyDefinitionId = CmisPropertyDefinitionId.VersionSeriesCheckedOutBy,
                QueryName = "cmis:versionSeriesCheckedOutBy",
                Value = null
            };
        }

        /// <summary>
        /// The object id of the PWC.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyVersionSeriesCheckedOutId()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Version Series Checked Out ID",
                LocalName = "VersionSeriesCheckedOutId",
                PropertyDefinitionId = CmisPropertyDefinitionId.VerisonSeriesCheckedOutId,
                QueryName = "cmis:versionSeriesCheckedOutId",
                Value = null
            };
        }

        /// <summary>
        /// The id of the version series (a transitively closed collection of all
        /// document objects that have been created from an original document in 
        /// the repository.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyVersionSeriesId()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Version Series ID",
                LocalName = "VersionSeriesId",
                PropertyDefinitionId = CmisPropertyDefinitionId.VersionSeriesId,
                QueryName = "cmis:versionSeriesId",
                Value = new string[] { "workspace://SpacesStore/7df6b8f6-12d8-4e4a-903d-63a47b88b56e" }
            };
        }

        /// <summary>
        /// The name of the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyName(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Name",
                LocalName = "Name",
                PropertyDefinitionId = CmisPropertyDefinitionId.Name,
                QueryName = CmisPropertyDefinitionId.Name,
                Value = value
            };
        }

        /// <summary>
        /// Textual comment associated with the given version.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyCheckinComment()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Checking Comment",
                LocalName = "CheckinComment",
                PropertyDefinitionId = CmisPropertyDefinitionId.CheckinComment,
                QueryName = "cmis:checkinComment",
                Value = null
            };
        }

        /// <summary>
        /// Id of the stream.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyContentStreamId(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Content Stream ID",
                LocalName = "ContentStreamId",
                PropertyDefinitionId = CmisPropertyDefinitionId.ContentStreamId,
                QueryName = CmisPropertyDefinitionId.ContentStreamId,
                Value = value
            };
        }

        /// <summary>
        /// File name of the content stream. 
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyContentStreamFileName(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Content Stream File Name",
                LocalName = "ContentStreamFileName",
                PropertyDefinitionId = CmisPropertyDefinitionId.ContentStreamFileName,
                QueryName = CmisPropertyDefinitionId.ContentStreamFileName,
                Value = value
            };
        }

        /// <summary>
        /// Length of the content stream (in bytes).
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyInteger CreateCmisPropertyContentStreamLength(int[] value)
        {
            return new CmisPropertyInteger()
            {
                DisplayName = "Content Stream Length",
                LocalName = "ContentStreamLength",
                PropertyDefinitionId = CmisPropertyDefinitionId.ContentStreamLength,
                QueryName = CmisPropertyDefinitionId.ContentStreamLength,
                Value = value
            };
        }

        /// <summary>
        /// MIME type of the content stream.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyContentStreamMimeType(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Content Stream MIME Type",
                LocalName = "ContentStreamMimeType",
                PropertyDefinitionId = CmisPropertyDefinitionId.ContentStreamMimeType,
                QueryName = CmisPropertyDefinitionId.ContentStreamMimeType,
                Value = value
            };
        }

        /// <summary>
        /// User who created the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyString CreateCmisPropertyCreatedBy(string[] value)
        {
            return new CmisPropertyString()
            {
                DisplayName = "Created By",
                LocalName = "CreatedBy",
                PropertyDefinitionId = CmisPropertyDefinitionId.CreatedBy,
                QueryName = CmisPropertyDefinitionId.CreatedBy,
                Value = value
            };
        }

        /// <summary>
        /// Id of the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyObjectId(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Object Id",
                LocalName = "ObjectId",
                PropertyDefinitionId = CmisPropertyDefinitionId.ObjectId,
                QueryName = CmisPropertyDefinitionId.ObjectId,
                Value = value
            };
        }

        /// <summary>
        /// The date and time (type DateTime) of when the object was 
        /// created.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyDateTime CreateCmisPropertyCreationDate(DateTime[] value)
        {
            return new CmisPropertyDateTime()
            {
                DisplayName = "Creation Date",
                LocalName = "CreationDate",
                PropertyDefinitionId = CmisPropertyDefinitionId.CreationDate,
                QueryName = CmisPropertyDefinitionId.CreationDate,
                Value = value
            };
        }

        /// <summary>
        /// Opaque token used for optimistic locking and concurrency
        /// checking. See section 2.2.1.3 Change Tokens.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyChangeToken()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Change Token",
                LocalName = "ChangeToken",
                PropertyDefinitionId = CmisPropertyDefinitionId.ChangeToken,
                QueryName = "cmis:changeToken",
                Value = null
            };
        }

        /// <summary>
        /// Id of the base object-type for the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyBaseTypeId(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Base Type Id",
                LocalName = "BaseTypeId",
                PropertyDefinitionId = CmisPropertyDefinitionId.BaseTypeId,
                QueryName = CmisPropertyDefinitionId.BaseTypeId,
                Value = value
            };
        }

        /// <summary>
        /// TRUE if the repository MUST throw an error at any attempt to update
        /// or delete the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyBoolean CreateCmisPropertyIsImmutable(bool[] value)
        {
            return new CmisPropertyBoolean()
            {
                DisplayName = "Is Immutable",
                LocalName = "IsImmutable",
                PropertyDefinitionId = CmisPropertyDefinitionId.IsImmutable,
                QueryName = CmisPropertyDefinitionId.IsImmutable,
                Value = value
            };
        }

        /// <summary>
        /// TRUE if the Document object is the latest major version in its 
        /// version series.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyBoolean CreateCmisPropertyIsLatestMajorVersion(bool[] value)
        {
            return new CmisPropertyBoolean()
            {
                DisplayName = "Is Latest Major Version",
                LocalName = "IsLatestMajorVersion",
                PropertyDefinitionId = CmisPropertyDefinitionId.IsLatestMajorVersion,
                QueryName = CmisPropertyDefinitionId.IsLatestMajorVersion,
                Value = value
            };
        }


        /// <summary>
        /// TRUE if the Document object is the latest major version in its 
        /// version series. Defaults to FALSE.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyIsMajorVersion()
        {
            return new CmisPropertyBoolean()
            {
                DisplayName = "Is Major Version",
                LocalName = "IsMajorVersion",
                PropertyDefinitionId = CmisPropertyDefinitionId.IsMajorVersion,
                QueryName = "cmis:isMajorVersion",
                Value = new bool[] { false }
            };
        }

        /// <summary>
        /// TRUE if the Document object is the latest version in its version series.
        /// Defaults to TRUE.
        /// </summary>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyIsLatestVersion()
        {
            return new CmisPropertyBoolean()
            {
                DisplayName = "Is Latest Version",
                LocalName = "IsLatestVersion",
                PropertyDefinitionId = CmisPropertyDefinitionId.IsLatestVersion,
                QueryName = "cmis:isLatestVersion",
                Value = new bool[] { true }
            };
        }

        /// <summary>
        /// TRUE if there currently exists a PWC for this version series.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisProperty CreateCmisPropertyIsVersionSeriesCheckedOut(bool[] value)
        {
            return new CmisPropertyBoolean()
            {
                DisplayName = "Is Version Series Checked Out",
                LocalName = "IsVersionSeriesCheckedOut",
                PropertyDefinitionId = CmisPropertyDefinitionId.IsVersionSeriesCheckedOut,
                QueryName = CmisPropertyDefinitionId.IsVersionSeriesCheckedOut,
                Value = value
            };
        }

        /// <summary>
        /// Date and time when the object was last modified.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyDateTime CreateCmisPropertyLastModificationDate(DateTime[] value)
        {
            return new CmisPropertyDateTime()
            {
                DisplayName = "Last Modification Date",
                LocalName = "LastModificationDate",
                PropertyDefinitionId = CmisPropertyDefinitionId.LastModificationDate,
                QueryName = CmisPropertyDefinitionId.LastModificationDate,
                Value = value
            };
        }


        /// <summary>
        /// Id of the parent folder of the object.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static CmisPropertyId CreateCmisPropertyParentId(string[] value)
        {
            return new CmisPropertyId()
            {
                DisplayName = "Parent Id",
                LocalName = "ParentId",
                PropertyDefinitionId = CmisPropertyDefinitionId.ParentId,
                QueryName = CmisPropertyDefinitionId.ParentId,
                Value = value
            };
        }

        #endregion

        #region Set up Repository

        /// <summary>
        /// Creates an array of repositories. In this case it will only
        /// contain one repository.
        /// </summary>
        /// <returns></returns>
        public static RepositoryEntry[] CreateRepositoryEntries()
        {
            return new RepositoryEntry[] { SampleFactory.CreateRepositoryEntry() };
        }

        /// <summary>
        /// Creates a dummy repository.
        /// </summary>
        /// <returns></returns>
        public static RepositoryEntry CreateRepositoryEntry()
        {
            return new RepositoryEntry()
            {
                Id = "sr1",
                Name = "Sample Repository"
            };
        }

        /// <summary>
        /// Define repository properties.
        /// </summary>
        /// <returns></returns>
        public static RepositoryInfo CreateRepositoryInfo()
        {
            return new RepositoryInfo()
            {
                RepositoryId = "sr1",
                RepositoryName = "Sample Repository (CMS)",
                RepositoryDescription = "A sample CMIS Repository.",
                VendorName = "Sample Vendor",
                ProductName = "CMIS Prototype for Sample CMS",
                ProductVersion = "1.0",
                RootFolderId = "rootfolder",
                LatestChangeLogToken = "token-Fri Sep 25 12:33:19 PDT 2009",
                // Define repository capabilities (see section 2.1.1.1 in CMIS spec)
                Capabilities = new RepositoryCapabilities()
                {
                    Acl = CapabilityAcl.Manage,
                    AllVersionsSearchable = true,
                    Changes = CapabilityChanges.All,
                    ContentStreamUpdatability = CapabilityContentStreamUpdates.Anytime,
                    GetDescendants = true,
                    GetFolderTree = false,
                    Multifiling = true,
                    PwcSearchable = true,
                    PwcUpdatable = true,
                    Query = CapabilityQuery.BothCombined,
                    Renditions = CapabilityRendition.Read,
                    Unfiling = true,
                    VersionSpecificFiling = true,
                    Join = CapabilityJoin.InnerAndOuter
                },
                CmisVersionSupported = 1.0m
            };
        }

        #endregion

        #region Misc

        #region Create pathed CMIS objects

        /// <summary>
        /// Creates a pathed CMIS object.
        /// </summary>
        /// <returns></returns>
        public static PathedCmisObject CreatePathedCmisObject()
        {
            return new PathedCmisObject()
            {
                Object = SampleFactory.CreateCmisObject(),
                RelativePathSegment = "rootfolder"
            };
        }

        /// <summary>
        /// Creates a pathed Document object.
        /// </summary>
        /// <returns></returns>
        //public static PathedCmisObject CreatePathedCmisObjectDocument()
        //{
        //    return new PathedCmisObject()
        //    {
        //        Object = SampleFactory.CreateCmisDocumentObject(),
        //        RelativePathSegment = "rootfolder"
        //    };
        //}

        /// <summary>
        /// Creates a pathed Folder object.
        /// </summary>
        /// <returns></returns>
        //public static PathedCmisObject CreatePathedCmisObjectFolder()
        //{
        //    return new PathedCmisObject()
        //    {
        //        Object = SampleFactory.CreateCmisFolderObject(),
        //        RelativePathSegment = "rootfolder"
        //    };
        //}

        /// <summary>
        /// Creates a pathed Folder2 object.
        /// </summary>
        /// <returns></returns>
        //public static PathedCmisObject CreatePathedCmisObjectFolder2()
        //{
        //    return new PathedCmisObject()
        //    {
        //        Object = SampleFactory.CreateCmisFolderObject2(),
        //        RelativePathSegment = "rootfolder"
        //    };
        //}

        /// <summary>
        /// Creates an empty pathed Folder object.
        /// </summary>
        /// <returns></returns>
        //public static PathedCmisObject CreateEmptyPathedCmisObjectFolder()
        //{
        //    return new PathedCmisObject()
        //    {
        //        Object = SampleFactory.CreateEmptyCmisObject(),
        //        RelativePathSegment = "rootfolder"
        //    };
        //}

        /// <summary>
        /// Creates a pathed object container. 
        /// </summary>
        /// <returns></returns>
        public static PathedCmisObjectContainer CreatePathedCmisObjectContainer()
        {
            return new PathedCmisObjectContainer()
            {
                ObjectInFolder = SampleFactory.CreatePathedCmisObject(),
                Children = null
            };
        }

        /// <summary>
        /// Creates a list of pathed CMIS objects (Folder, Folder2, Document).
        /// </summary>
        /// <returns></returns>
        //public static PathedCmisObjectList CreatePathedCmisObjectList()
        //{
        //    List<PathedCmisObject> tempList = new List<PathedCmisObject>();
        //    tempList.Add(CreatePathedCmisObjectFolder());
        //    tempList.Add(CreatePathedCmisObjectFolder2());
        //    tempList.Add(CreatePathedCmisObjectDocument());
        //    //tempList.Add(CreatePathedCmisObjectImage());

        //    PathedCmisObjectList list = new PathedCmisObjectList()
        //    {
        //        Objects = tempList.ToArray(),
        //        HasMoreItems = false,
        //        NumItems = tempList.Count.ToString()
        //    };

        //    return list;
        //}

        #endregion

        /// <summary>
        /// Create a PDF rendition object.
        /// </summary>
        /// <returns></returns>
        public static Rendition CreateRendition()
        {
            return new Rendition()
            {
                Height = "600",
                Kind = "PDF File",
                Length = "4711",
                MimeType = "application/pdf",
                RenditionDocumentId = "RenditionDocumentId 1",
                StreamId = "StreamId 1",
                Title = "PDF Rendition of document",
                Width = "400"
            };
        }

        /// <summary>
        /// ???
        /// </summary>
        /// <returns></returns>
        public static CopyFlaggedDocumentId CreateCopyFlaggedDocumentId()
        {
            return new CopyFlaggedDocumentId()
            {
                DocumentId = "Document 4711",
                ContentCopied = false
            };
        }

        /// <summary>
        /// Creates a CMIS change event. (???)
        /// </summary>
        /// <returns></returns>
        public static CmisChangeEvent CreateCmisChangeEvent()
        {
            return new CmisChangeEvent()
            {
                ChangeTime = DateTime.Now,
                ChangeType = TypeOfChanges.Created
            };
        }

        /// <summary>
        /// Creates a checked out CMIS Document object.
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCmisCheckedOutObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "checkedOutDocument",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisDocumentProperties().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        /// <summary>
        /// Creates an unfiled CMIS Document object.
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCmisUnfiledObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "checkedOutDocument",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisDocumentProperties().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        /// <summary>
        /// Creates a sample Document object. 
        /// (Creates a sample <see cref="NCMIS.ObjectModel.CmisObject"/> folder instance.)
        /// </summary>
        /// <returns>A <see cref="NCMIS.ObjectModel.CmisObject"/> instance.</returns>
        public static CmisObject CreateCmisDocumentObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "ncmisSites",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisDocumentProperties().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        //public static CmisObject CreateCmisImageObject()
        //{
        //    CmisObject retObject = new CmisObject()
        //    {
        //        Id = "calypsoo_logo",
        //        Properties = new CmisProperties
        //        {
        //            Items = SampleFactory.CreateCmisImageProperties().Items,
        //        },
        //        Relationship = null
        //    };

        //    return retObject;
        //}

        /// <summary>
        /// Creates a sample Folder object.
        /// </summary>
        /// <returns></returns>
        public static CmisObject CreateCmisFolderObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "NcmisFolder",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisFolderProperties().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        public static CmisObject CreateCmisFolderObject2()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "ImagesFolder",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisFolderProperties2().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        /// <summary>
        /// Creates a sample <see cref="NCMIS.ObjectModel.CmisObject"/> instance.
        /// </summary>
        /// <returns>A <see cref="NCMIS.ObjectModel.CmisObject"/> instance.</returns>
        public static CmisObject CreateCmisObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "ncmisSites",
                //Acl = SampleFactory.CreateAccessControlList(),
                //AllowableActions = SampleFactory.CreateAllowableActions(),
                //ChangeEventInfo = SampleFactory.CreateCmisChangeEvent(),
                //ExactAcl = true,
                //PolicyIds = new ListOfIds()
                //{
                //    id = new string[] { "Policy Id 1", "Policy Id 2", "Policy Id 3", }
                //},
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisProperties().Items,
                },
                Relationship = null,
                //Rendition = new Rendition[] { SampleFactory.CreateRendition() }
            };

            return retObject;
        }

        private static CmisObject CreateEmptyCmisObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = null,
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisProperties().Items,
                },
                Relationship = null,
            };

            return retObject;
        }

        public static CmisObject CreateCmisPolicyObject()
        {
            CmisObject retObject = new CmisObject()
            {
                Id = "NcmisPolicy",
                Properties = new CmisProperties
                {
                    Items = SampleFactory.CreateCmisPolicyProperties().Items,
                },
                Relationship = null
            };

            return retObject;
        }

        public static CmisObjectList CreateCmisCheckedOutObjectList()
        {
            return new CmisObjectList()
            {
                Objects = new CmisObject[]
                {
                    SampleFactory.CreateCmisCheckedOutObject()
                },
                HasMoreItems = false,
                NumItems = "1"
            };
        }

        public static CmisObjectList CreateCmisUnfiledObjectList()
        {
            return new CmisObjectList()
            {
                Objects = new CmisObject[]
                {
                    SampleFactory.CreateCmisUnfiledObject()
                },
                HasMoreItems = false,
                NumItems = "1"
            };
        }

        public static CmisObjectList CreateCmisObjectList()
        {
            return new CmisObjectList()
            {
                Objects = new CmisObject[]
                {
                    SampleFactory.CreateCmisObject()
                },
                HasMoreItems = false,
                NumItems = "1"
            };
        }

        //public static CmisObjectParents CreateCmisObjectParents()
        //{
        //    PathedCmisObject pathedCmisObject = SampleFactory.CreatePathedCmisObject();
        //    return new CmisObjectParents(new List<PathedCmisObject>(new PathedCmisObject[] { pathedCmisObject }));
        //}


        public static TokenedCmisObjectId CreateTokenedCmisObjectId()
        {
            return new TokenedCmisObjectId()
            {
                ObjectId = "Object 4711",
                ChangeToken = "Change Token 17"
            };
        }

        public static TokenedCmisObjectList CreateTokenedCmisObjectList()
        {
            return new TokenedCmisObjectList()
            {
                Objects = SampleFactory.CreateCmisObjectList(),
                ChangeToken = "Change Tokens"
            };
        }

        public static TokenedDocumentId CreateTokenedDocumentId()
        {
            return new TokenedDocumentId()
            {
                DocumentId = "Document 4711",
                ChangeToken = "Change Token 17"
            };
        }

        public static TypeContainer CreateDocumentTypeContainer()
        {
            return new TypeContainer()
            {
                Type = SampleFactory.CreateTypeDefinition("cmis:document"),
                Children = null
            };
        }

        public static TypeContainer CreateFolderTypeContainer()
        {
            return new TypeContainer()
            {
                Type = SampleFactory.CreateTypeDefinition("cmis:folder"),
                Children = new TypeContainer[]
                {
                    new TypeContainer()
                    {
                        Type = SampleFactory.CreateTypeDefinition("cmis:folder:descendant"),
                        Children = null
                    }
                }
            };
        }

        public static TypeContainer CreatePolicyTypeContainer()
        {
            return new TypeContainer()
            {
                Type = SampleFactory.CreateTypeDefinition("cmis:policy"),
                Children = null
            };
        }

        public static TypeContainer CreateRelationshipTypeContainer()
        {
            return new TypeContainer()
            {
                Type = SampleFactory.CreateTypeDefinition("cmis:relationship"),
                Children = null
            };
        }

        public static TypeContainer CreateTypeContainer()
        {
            return new TypeContainer()
            {
                Type = new TypeFolderDefinition()
                {
                    BaseId = BaseObjectTypeId.CmisFolder,
                    ControllableAcl = false,
                    ControllablePolicy = false,
                    Creatable = true,
                    Description = "Folder Type",
                    DisplayName = "Folder",
                    Fileable = false,
                    FulltextIndexed = true,
                    Id = "cmis:folder",
                    IncludedInSupertypeQuery = true,
                    LocalName = "folder",
                    LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                    ParentId = null,
                    Queryable = true,
                    QueryName = "cmis:folder",
                },
                Children = new TypeContainer[]
                {
                    new TypeContainer()
                    {
                        Type = new TypeFolderDefinition()
                        {
                            BaseId = BaseObjectTypeId.CmisFolder, // TODO: change id to "F:cm:systemfolder"
                            ControllableAcl = false,
                            ControllablePolicy = false,
                            Creatable = true,
                            Description = "Folder for containing system-level items",
                            DisplayName = "System Folder",
                            Fileable = false,
                            FulltextIndexed = true,
                            Id = "cmis:folder",
                            IncludedInSupertypeQuery = true,
                            LocalName = "folder",
                            LocalNamespace = "http://www.episerver.com/model/content/1.0",
                            ParentId = null,
                            Queryable = true,
                            QueryName = "cmis:folder",
                        },
                        Children = null,
                    },
                },
            };
        }

        public static TypeContainer[] CreateTypeContainers()
        {
            return new TypeContainer[]
            {
                SampleFactory.CreateFolderTypeContainer(),
                SampleFactory.CreateDocumentTypeContainer(),
                SampleFactory.CreatePolicyTypeContainer(),
                SampleFactory.CreateRelationshipTypeContainer()
            };
        }

        public static TypeDefinition CreateTypeDefinition(string typeId)
        {
            TypeDefinition typeDefinition = null;

            switch (typeId)
            {
                case "cmis:document":
                    typeDefinition = new TypeDocumentDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisDocument,
                        ContentStreamAllowed = ContentStreamAllowed.Allowed,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Document Type",
                        DisplayName = "Document",
                        Fileable = true,
                        FulltextIndexed = true,
                        Id = "cmis:document",
                        IncludedInSupertypeQuery = true,
                        LocalName = "document",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:document",
                        Versionable = true,
                        PropertyDefinitions = new PropertyDefinition[]
                        {
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Name),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.BaseTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreatedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModifiedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModificationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ChangeToken),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.IsImmutable),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.IsLatestVersion),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.IsMajorVersion),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.IsLatestMajorVersion),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.VersionLabel),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.VersionSeriesId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.IsVersionSeriesCheckedOut),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.VersionSeriesCheckedOutBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.VerisonSeriesCheckedOutId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CheckinComment),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ContentStreamLength),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ContentStreamMimeType),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ContentStreamId)
                        }
                    };
                    break;
                case "cmis:folder":
                    typeDefinition = new TypeFolderDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisFolder,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Folder Type",
                        DisplayName = "Folder",
                        Fileable = false,
                        FulltextIndexed = true,
                        Id = "cmis:folder",
                        IncludedInSupertypeQuery = true,
                        LocalName = "folder",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:folder",
                        PropertyDefinitions = new PropertyDefinition[]
                        {
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Name),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.BaseTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreatedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModifiedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModificationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ChangeToken),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ParentId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Path),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.AllowedChildObjectTypeIds),
                        }
                    };
                    break;
                case "cmis:policy":
                    typeDefinition = new TypePolicyDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisPolicy,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Policy Type",
                        DisplayName = "Policy",
                        Fileable = false,
                        FulltextIndexed = false,
                        Id = "cmis:policy",
                        IncludedInSupertypeQuery = true,
                        LocalName = "policy",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:policy",
                        PropertyDefinitions = new PropertyDefinition[]
                        {
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Name),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.BaseTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreatedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModifiedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModificationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ChangeToken),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.PolicyText),
                        }
                    };
                    break;
                case "cmis:relationship":
                    typeDefinition = new TypeRelationshipDefinition()
                    {
                        AllowedSourceTypes = new string[] { string.Empty },
                        AllowedTargetTypes = new string[] { string.Empty },
                        BaseId = BaseObjectTypeId.CmisRelationship,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Relationship Type",
                        DisplayName = "Relationship",
                        Fileable = false,
                        FulltextIndexed = false,
                        Id = "cmis:relationship",
                        IncludedInSupertypeQuery = true,
                        LocalName = "relationship",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:relationship",
                        PropertyDefinitions = new PropertyDefinition[]
                        {
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Name),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.BaseTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreatedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModifiedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModificationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ChangeToken),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.SourceId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.TargetId),
                        }
                    };
                    break;
                case "cmis:folder:descendant":
                    typeDefinition = new TypeFolderDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisFolder,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Folder Descendant Type",
                        DisplayName = "Folder Descendant",
                        Fileable = false,
                        FulltextIndexed = true,
                        Id = "cmis:folder:descendant",
                        IncludedInSupertypeQuery = true,
                        LocalName = "folderDescendant",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:folder:descendant",
                        PropertyDefinitions = new PropertyDefinition[]
                        {
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Name),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.BaseTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ObjectTypeId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreatedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.CreationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModifiedBy),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.LastModificationDate),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ChangeToken),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.ParentId),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.Path),
                            Repository.GetPropertyDefinition(CmisPropertyDefinitionId.AllowedChildObjectTypeIds),
                        }
                    };
                    break;
            }
            return typeDefinition;
        }

        public static TypeDefinitionList CreateTypeDefinitionList()
        {
            return new TypeDefinitionList()
            {
                Types = new TypeDefinition[]
                {
                    // Folder
                    new TypeFolderDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisFolder,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Folder Type",
                        DisplayName = "Folder",
                        Fileable = false,
                        FulltextIndexed = true,
                        Id = "cmis:folder",
                        IncludedInSupertypeQuery = true,
                        LocalName = "folder",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:folder",
                    },
                    // Document
                    new TypeDocumentDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisDocument,
                        ContentStreamAllowed = ContentStreamAllowed.Allowed,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Document Type",
                        DisplayName = "Document",
                        Fileable = true,
                        FulltextIndexed = true,
                        Id = "cmis:document",
                        IncludedInSupertypeQuery = true,
                        LocalName = "document",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:document",
                        Versionable = true,
                    },
                    // Relationship
                    new TypeRelationshipDefinition()
                    {
                        AllowedSourceTypes = new string[] { string.Empty },
                        AllowedTargetTypes = new string[] { string.Empty },
                        BaseId = BaseObjectTypeId.CmisRelationship,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Relationship Type",
                        DisplayName = "Relationship",
                        Fileable = false,
                        FulltextIndexed = false,
                        Id = "cmis:relationship",
                        IncludedInSupertypeQuery = true,
                        LocalName = "relationship",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:relationship",
                    },
                    // Policy
                    new TypePolicyDefinition()
                    {
                        BaseId = BaseObjectTypeId.CmisPolicy,
                        ControllableAcl = false,
                        ControllablePolicy = false,
                        Creatable = true,
                        Description = "Policy Type",
                        DisplayName = "Policy",
                        Fileable = false,
                        FulltextIndexed = false,
                        Id = "cmis:policy",
                        IncludedInSupertypeQuery = true,
                        LocalName = "policy",
                        LocalNamespace = "http://www.episerver.com/model/cmis/1.0/cd04",
                        ParentId = null,
                        Queryable = true,
                        QueryName = "cmis:policy",
                    },
                },
                HasMoreItems = false,
                NumItems = "1",
            };
        }

        private static byte[] ConvertStreamToByteArray(Stream stream)
        {
            int length = Convert.ToInt32(stream.Length);
            byte[] data = new byte[length];
            stream.Read(data, 0, length);
            //stream.Close();
            return data;
        }
        #endregion

        #region Create properties for misc objects

        /// <summary>
        /// Creates CMIS Document properties
        /// </summary>
        /// <returns></returns>
        public static CmisProperties CreateCmisDocumentProperties()
        {
            return new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                    CreateCmisPropertyContentStreamId(new string[] { "cm:content" }),
                    CreateCmisPropertyContentStreamLength(new int[] { 123 }),
                    CreateCmisPropertyVersionSeriesCheckedOutBy(),
                    CreateCmisPropertyDocumentObjectTypeId(),
                    CreateCmisPropertyVersionSeriesCheckedOutId(),
                    CreateCmisPropertyName(new string[] { "NCMIS Document 5" }),
                    CreateCmisPropertyContentStreamMimeType(new string[] { "text/plain" }),
                    CreateCmisPropertyVersionSeriesId(),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyChangeToken(),
                    CreateCmisPropertyIsLatestVersion(),
                    CreateCmisPropertyVersionLabel(),
                    CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyCheckinComment(),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyIsMajorVersion(),
                    CreateCmisPropertyIsImmutable(new bool[] { false }),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                    CreateCmisPropertyContentStreamFileName(new string[] { "readme.txt" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),

                    CreateCmisPropertyParentId(new string[] { "rootfolder" } ),
                    CreateCmisPropertyPath(new string[] { "/NcmisSites" } ),
                }
            };
        }

        /// <summary>
        /// Creates CMIS Image properties
        /// </summary>
        /// <returns></returns>
        public static CmisProperties CreateCmisImageProperties()
        {
            return new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyIsLatestMajorVersion(new bool[] { true }),
                    CreateCmisPropertyContentStreamId(new string[] { "cm:content" }),
                    CreateCmisPropertyContentStreamLength(new int[] { 123 }),
                    CreateCmisPropertyVersionSeriesCheckedOutBy(),
                    CreateCmisPropertyObjectTypeId(new string[] { "calypsoo_logo" }),
                    CreateCmisPropertyVersionSeriesCheckedOutId(),
                    CreateCmisPropertyName(new string[] { "calypsoo_logo.png" }),
                    CreateCmisPropertyContentStreamMimeType(new string[] { "application/octet-stream" }),
                    CreateCmisPropertyVersionSeriesId(),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyChangeToken(),
                    CreateCmisPropertyIsLatestVersion(),
                    CreateCmisPropertyVersionLabel(),
                    CreateCmisPropertyIsVersionSeriesCheckedOut(new bool[] { false }),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyCheckinComment(),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyIsMajorVersion(),
                    CreateCmisPropertyIsImmutable(new bool[] { false }),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:document" }),
                    CreateCmisPropertyContentStreamFileName(new string[] { "calypsoo_logo.png" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                }
            };
        }

        /// <summary>
        /// Creates CMIS Folder properties
        /// </summary>
        /// <returns></returns>
        public static CmisProperties CreateCmisFolderProperties()
        {
            CmisProperties properties = null;
            properties = new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyAllowedChildObjectTypeIds(null),
                    CreateCmisPropertyFolderObjectTypeId(),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyPath(new string[] { "/NcmisSites" }),
                    CreateCmisPropertyName(new string[] { "NCMIS Sites" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyChangeToken(),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyParentId(new string[] { "ncmis:folder-123456789" }),
                }
            };
            return properties;
        }

        public static CmisProperties CreateCmisFolderProperties2()
        {
            return new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyAllowedChildObjectTypeIds(null),
                    CreateCmisPropertyFolderObjectTypeId(),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyPath(new string[] { "/Images" }),
                    CreateCmisPropertyName(new string[] { "Web Projects" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyChangeToken(),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyParentId(new string[] { "ncmis:folder-123456789" }),
                }
            };
        }

        public static CmisProperties CreateCmisPolicyProperties()
        {
            return new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyPolicyObjectTypeId(),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyName(new string[] { "NCMIS Sites" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:policy" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                }
            };
        }

        public static CmisProperties CreateCmisProperties()
        {
            return new CmisProperties
            {
                Items = new CmisProperty[]
                {
                    CreateCmisPropertyAllowedChildObjectTypeIds(null),
                    CreateCmisPropertyDocumentObjectTypeId(),
                    CreateCmisPropertyLastModifiedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyPath(new string[] { "/NcmisSites2" }),
                    CreateCmisPropertyName(new string[] { "NCMIS Sites" }),
                    CreateCmisPropertyCreatedBy(new string[] { "Administrator" }),
                    CreateCmisPropertyObjectId(new string[] { "ncmis:document-123456789" }),
                    CreateCmisPropertyCreationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyChangeToken(),
                    CreateCmisPropertyBaseTypeId(new string[] { "cmis:folder" }),
                    CreateCmisPropertyLastModificationDate(new DateTime[] { DateTime.Now }),
                    CreateCmisPropertyParentId(new string[] { "ncmis:folder-123456789" }),
                }
            };
        }

        public static CmisProperty CreateCmisProperty()
        {
            return new CmisPropertyString()
            {
                DisplayName = "Cmis Property 1",
                LocalName = "Cmis Property 1 Local Name",
                PropertyDefinitionId = CmisPropertyDefinitionId.Name,
                QueryName = "cmis:name",
                Value = new string[] { "NCMIS:Sites" }
            };
        }
        #endregion
    }
}